package com.atguigu.gmall.realtime.joindemo;

import com.atguigu.gmall.realtime.app.BaseSQLApp;
import com.atguigu.gmall.realtime.util.SQLUtil;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
import org.apache.flink.table.api.bridge.java.StreamTableEnvironment;

/**
 * @Author lzc
 * @Date 2022/12/30 10:15
 */
public class SQL_Consume_LeftJoin extends BaseSQLApp {
    public static void main(String[] args) {
        new SQL_Consume_LeftJoin().init(
            5005,
            2,
            "SQL_Consume_LeftJoin"
        );
        
    }
    
    @Override
    public void handle(StreamExecutionEnvironment env,
                       StreamTableEnvironment tEnv) {
        
        tEnv.executeSql("create table tb(" +
                            " id int, " +
                            " name string, " +
                            " age int " +
                            ")" + SQLUtil.getKafkaSourceDDL("tb", "atguigu", "json"));
    
       
        tEnv.sqlQuery("select * from tb").execute().print();
     
    }
}
/*
id   amount     name(右表)
1      100       null
null
1      100       李四

将来消费会消费到 2 条数据:
1      100       null
1      100       李四

 */